+---------------------------------------------------------------------------+  
|                      SCENERY MAKER: REFERENCE GUIDE                       |  
+---------------------------------------------------------------------------+  
  
NOTE ON CASE: in the following reference, Scenery MAKER commands are 
consistently given in upper case; however Scenery MAKER is completely CASE 
INSENSITIVE, i.e. commands and names (of variables, labels, macros and macro  
parameters) can be given in lower case, upper case, or any mixture of both 
and still be considered equal, as far as Scenery  
MAKER is concerned.  
  
  
NAMES  
  
"Names" are, well..., names you give to variables, labels, macros, and macro 
parameters in your Scenery MAKER programs. Sometimes, they are also called 
"identifiers" or, in short, ID's.  
  
Names should begin with an alphabetic character (from 'a' to 'z') or an 
underscore ('_'); after the first character, they may contain also digits. 
For instance,  
  
	Aname  
	_another_name  
	NameNumber2  
  
are legal names, while:  
  
	3rdName  
	#NotAName  
	Don'tChange!  
  
are not legal names: the first because it begins with a digit, the second 
because it begins with an illegal character (the pound sign) and the third 
because it contains two illegal characters (the apostrophe and the 
exclamation mark).  
  
In some special cases, names may have a colon (':') or a dollar sign ('$') 
appended to them.  
  
Names are not sensitive to upper or lower case; that is:  
  
	Foo  
	FOO  
	foO  
  
are the same name, as far as Scenery MAKER is concerned.  
  
Names can have any length, for instance:  
  
	aVeryLongAndUnusualNameOrIdentifierWhichIs58CharactersLong  
  
is a legal name and will be stored with all its 58 characters; however, as 
longer names take more memory and require more time to be retrieved, matched 
and processed, it is wise to keep them as short as possible.  
  

NUMBERS  
  
All numeric values are stored internally as floating point numbers with 15 
significant digits (i.e. with a precision of one millimeter out of a billion 
of kilometers). Numbers can be expressed in several ways.  
  
* Decimal numbers, like for instance:  
  
	1234  
	1234.5678  
	-4321  
  
Decimal number may contain a fractionary part, indicated by the period ('.') 
and an initial sign( '-' or '+').  
  
* Hexdecimal numbers, with the "0x" (or "0X") prefix followed by up to 8 hex 
digits (0-9, a-f, A-F):  
  
	0xABEF  
	0x12345678  
  
Hexdecimal numbers cannot contain a fractionary period or a sign.  
  
* Binary numbers, with the "0b" (or "0B") prefix followed by up to 32 binary 
digits (0's or 1's):  
  
	0b11110000  
  
Binary numbers also cannot contain a fractionary period or a sign. Binary 
numbers are useful to indicate bit masks or bit patterns in bitwise 
operations, like | or &.  
  
* Geographic coordinates, with the pattern:  
  
	999d99m99.9999s[N|S] | [E|W]  
  
where 'd', 'm', and 's' mark respectively the degrees, minutes, and seconds 
parts and N or S (for latitudes) and E or W (for longitudes) indicate the 
emisphere.  
  
Each part is optional, but there should be at least one of them!  
  
'N', 'S', 'E', or 'W' are optional; if they lack, 'N' (for latitudes) or 'E' 
(for longitudes) are assumed. Instead of 'S' or 'W', an initial minus sign 
can also be used.  

Between the various parts there should be NO blank space.  
  
'd', 'm', 's', 'N', 'S', 'E', 'W' can indifferently be in lower case or 
upper case.  
  
These are examples of valid geographic coordinates:  
  
	7d25m30s  
	7d  
	0d17m12.34sS  
	-120D34m45.67S  
  
Geographic coordinates evaluate to the total number of seconds they 
correspond to; for instance:  0d10m12.34s  is the same as the number 612.34.  
  
If necessary, they can be properly scaled via multiplicative constants, 
possibly stored as macro (see below, under "Macros").  
  
* Time, with the pattern:  
  
	99h99m99.9999s  
  
where 'h', 'm', and 's' mark the hours, minutes and seconds parts. The same 
restrictions given for geographic coordinates apply also to time indications. 
Time indications evaluate to the total number of seconds they correspond to; 
for instance, 1h0m34s evaluates to the number 3634.  
  
* Angles, with the pattern:  
  
	999.9999deg  
  
360deg evaluates to 65536 (or 0x10000) and other angles evaluate 
proportionally.  
  
  
STRINGS  
  
Strings are successions of characters. They are indicated by a text enclosed 
between quotes ('"'); for instance:  
  
	"A string"  
  
is a string!  
  
Strings cannot directly contain control characters, i.e. non-printable 
characters whose ASCII code is lower than 32; to express them in a string 
the C-like hex notation  
  
	\xFF  
  
can be used, where "FF" are two hex digits. Please note that there shall 
always be TWO digits.  
  
The following digraphs can also be used for some of the most common control 
characters:  
  
	\n              for a newline character (ASCII code 13)  
	\r              for a carriage return character (ASCII code 10)  
	\t              for a TAB character (ASCII code 9)  
  
Also, a string cannot directly contain a quote ('"') or a back-slash ('\'), 
which can be expressed as:  
	
	\"		for a quote within a string  
	\\              for a back-slash within a string  
  
Strings can be 512 characters long at maximum.  
  
LABELS  
  
Labels are indicated with a name ending with a colon (':'), like:  
  
	ALabel:  
  
A label is equivalent to the offset into the output file of the point where 
the label is placed and this value is used whenever the label is referenced.  
  
For instance:  
  
	...  
	here:  
	dw 10, here  
	...  
  
will output two words, one with the value 10 and another with the offset of 
the first word into the output file itself.  
  
Once defined, a label CANNOT be redefined!  
  
Labels can be even used before being defined, but only in expressions, not 
in conditions.  All the elements of a condition must be known in advance, 
otherwise the condition may give different results during the different 
compilation passes.  
  
VARIABLES  
  
Variables are named 'boxes' which can be used to store calculation results, 
set values or to express conditions. They are maintained internally into 
Scenery MAKER and will not be output into the generated file, unless output 
generating commands are used on them.  
  
Variables need not to be declared before being assigned a value; however a 
variable is not defined until some value is assigned to it.  
  
Variables may contain numbers or strings. If a simple name is used, as in 
"foo", the variable is generic and may contain either a number or a string; 
if a name ending with '$' is used, the variable is declared as a string 
variable and may contain only a string.  
  
In any case, once a variable is created, its contents may be changed, but 
not its type; for instance, with the statement  
  
	foo = 2  
  
the variable foo is created as a numeric variable and the assignment  
  
	foo = "Press any key to continue"  
  
will be no longer possible.  
  
  
BUILT-IN VARIABLE  
  
Scenery MAKER has four built-in variables, which can only be read. Attempts 
to change their values result in syntax errors.  
  
$  
  
The built-in pseudo-variable $ returns at any moment the current offset into 
the output file. For instance:  
  
	here:  
	dw val1, val2, $ - here  
  
will output three words, the third being the distance from itself and the 
label "here".  
  
__SECT0, __FIRSTFREQ, __LASTFREQ  
  
These variables are useful for filling VOR- and ILS-related fields in Flight 
Simulator BGL headers. If the command __NAVTAB (see below) is used, they 
contain, respectively, the file offset of the resulting BGL section 0, the 
code of the first and of the last frequency actually present in the same 
section. If __NAVTAB is not used, all three ccontain 0.  
  
  
NUMERIC EXPRESSIONS and OPERATORS  
  
Whenever a value is required, this value may be given directly (as an 
explicit number or string) or may be the result of an expression.  
  
Numeric expressions (nexp) are made of numbers or numeric variables combined 
with the following operators:  
  
	NOT             logical negation  
	~               bitwise negation (replaces all 0's with 1's and 
			viceversa)  
	+ -             unary plus and minus  
	KHz  MHz        KHz and MHz modifiers (see below)  
	* /             multiply, divide  
	+ -             sum, subtraction  
	&               bitwise AND  
	^               bitwise XOR  
	|               bitwise OR  
	AND             logical AND  
	OR              logical OR  
	< <= > >=       lower, lower or equal, greater, greater or equal 
			conditions  
	== !=           equality, inequality conditions  
  
Bitwise operations differ from logical operations because the former act on 
the individual bits of the operands, while the latter yield a logical 
(Boolean) result, which can be either 0 (false) or 1 (true); for instance  
1 | 2  yields 3 (0b01 | 0b10 = 0b11), while 1 OR 2 yields 1 (= true, because 
at least one of the operators is true, i.e. non-zero).  
  
Please note that bitwise operations pass through an internal conversion into 
a 32-bits integer representation and may loose precision if applied to very 
large or very small numbers.  
  
The inequality operator can also be indicated with '<>'.  
  
Please note the difference between the assignment operator:  
  
	=  
  
and the equality operator:  
  
	==  
  
The first is used to assign values to variables, the second tests if two 
values are equal and they cannot be used indifferently.  
  
The KHz and MHz modifiers are placed AFTER a number or an expression and 
convert the value into the BCD notations used by Flight Simulator for 
frequencies.  
  
MHz values are assumed to be within the range from 100.00 to 199.99, KHz 
values are assumed to be less then 1000. Values outside the given ranges 
may result in unexpected conversions.  
  
Both MHz and KHz values can have up to 2 decimal digits; if there are more 
than 2 decimal digits, the digits from the third onward are ignored.  
  
The intended use of the MHz modifier is with a DW command, for instance:  
  
	dw 108.25 MHz  
  
will output the given frequency as a word in the Flight Simulator MHz 
representation.  
  
The intended use of the KHz modifier is with either a DW or a D3 command, 
for instance:  
  
	dw 690.50 KHz  
  
will output the given frequency as a word in the 'short' Flight Simulator 
KHz representation, where decimals are ignored;  
While:  
  
	d3 690.50 KHz  
  
will output the given frequency as a 3 byte value in the 'long' Flight 
Simulator KHz representation, where decimals are maintained.  
  
Operators have a precedence and, in the table above, they have been listed 
in decreasing order of precedence from highest to lowest; operators with 
higher precedence are executed before operators with lower precedence: 
i.e. 1 + 2 * 3 yields 7 (2 * 3 is executed first) and not 9; to override 
the precedence, parenteses can be used: (1+2) * 3 yields 9.  
  
Operators listed on the same line have the same precedence and are executed 
from left to right.  
  
  
FUNCTIONS  
  
The following built-in functions can be used with numeric values or 
expressions:  
  
	SQRT(nexp)  
square root; if nexp is negative, the positive is used instead and a warning 
message is issued  
  
	SIN(nexp)  
sine; the argument is assumed to be expressed in seconds  
  
	COS(nexp)  
cosine; the argument is assumed to be expressed in seconds  
  
	POW(nexp1, nexp2)  
nexp1 elevated at the nexp2-th power  
  
	DEF(symbolname)  
return TRUE if the symbol "symbolname" is defined, FALSE if it is not. The 
symbol may actually be a variable, a macro or a label and its name should 
not be enclosed with quotes; i.e.:  
  
	IF DEF(foo)  
		... statement list 1...  
	ELSE  
		... statement list 2...  
	ENDIF  
  
will execute the statement list 1 if a symbol called "foo" has been defined 
and the statement list 2, if it has been not defined.  
  
Case in function names is not relevant.  
  
  
STRING EXPRESSIONS  
  
String expressions (sexp) can only be explicit strings or variables to which 
a string has been assigned; the only string 'operator' is the fixed-length 
operator:  
  
	(STRING nexp) sexp  
  
which forces the string given by sexp to the length indicated by the nexp 
value; if the string is longer it is truncated, if it is shorter it is padded 
with spaces. Please note the string is actually never changed and any 
truncation or padding is applied only to the output, if any. Thus, for 
instance, in  
  
	...  
	STR = "a string"  
	DB (STRING 3) STR  
	DB STR  
	...  
  
the first DB outputs only the first 3 characters of the string ("a s"), but 
the value of STR is still intact and the second DB will output the full 
"a string".  
  
  
COMMANDS  
  
Commands are the statements that actually do something in a Scenery MAKER 
program.  
  
Commands may be spread across several lines, as well as several commands may 
be put in the same line; for instance, the above example can be formatted 
also as in  
  
	...  
	str="a string" DB (string 3)str db str  
	...  
  
as well as in  
  
	...  
	str=  
		"a string"  
	db (  
		string  
		3  
		)str db str  
	...  
  
Spaces, tabs and new lines are collectively known as "blanks"; blank, as 
well as comments (see below) can be freely inserted between any two 
components of a command; they can also be removed whenever there is no risk 
of concatenating several word into a single name or keyword.  
For instance,  
  
	db(val1+val2),val3  
  
and  
  
	db ( val1 + val2 ) , val3  
  
are equivalent and both are legal.  
  
The following commands are implemented.  
  
DB nexp, nexp...  or DB sexp, ...  
  
Outputs each nexp as a single byte and each sexp as a sequence of characters 
(possibly with fixed length). If the numeric value is larger than 256 (the 
greatest number that fits in a byte), only its low order byte is output.  
  
Each DB instruction can have any number of arguments and nexp or sexp can be 
mixed without restriction as in:  
  
DB 23, "NOTICE\n", (string width) warning$, sqrt(pow(lat,2)+pow(lon,2))  
_____  
  
DW nexp, nexp...  
  
Outputs each nexp as a single word. If the numeric value is larger than 65536 
(the greatest number that fits in a word), only its low order word is output.  
DW cannot be used with strings.  
  
Each DW instruction can have any number of nexp arguments. Example:  
  
DW 10, foo, -bar, endmark  
_____  
  
D3 nexp, nexp...  
  
Same as DW, excepted that the 3 low order bytes are output.  
_____  
  
DD nexp, nexp...  
  
Same as DW, excepted that the 2 low order words (4 bytes) are output.  
_____  
  
DT nexp, nexp...  
  
Same as DW, excepted that the 3 low order words (6 bytes) are output.  
_____  
  
DQ nexp, nexp...  
  
Same as DW, excepted that the 4 low order words (8 bytes) are output.  
_____  
  
COPY sexp  
  
sexp is assumed to be a file name and the file itself is copied as it is at 
the current position of the output file. This command is used to insert a 
file which has already been compiled into a larger output file.  
  
Please note the difference between the COPY and the INCLUDE commands: COPY 
inserts a compiled file into the output, while INCLUDE retrieves a textual 
source file and compiles it.  
  
Note also that sexp is a normal string expression and, if given directly, it 
MUST be encosed between quotes.  
  
However, because the string is assumed to be a file name, the '\' character 
has not its special meaning and can be used directly; es.:  
  
	COPY "c:\scenery\myfile.obj"  
  
NOTE: The above commands are the only ones which actually generate some 
output; all other commands are used to prepare or to control how that output 
is generated.  
_____  
  
IF (condition) statements ... ELSE statements... ENDIF  
  
If the condition is true, the first series of statements is executed; if the 
condition is false, the second series of statements is executed. The "ELSE 
statements..." portion is optional and, if it is missing and the condition is 
false, nothing will be executed.  
  
The condition can be any nexp and may contain logical (Boolean) conditions as 
well as any other numeric operator; it is considered false if evaluates to 0 
and true otherwise.  
  
The parenteses around the condition are optional, but their use is 
recommended for clarity.  
  
Examples:  
  
	IF (val == 3)  
		DW 3  
	ELSE  
		DW 0  
	ENDIF  
_____  
  
INCLUDE sexp  
  
sexp is assumed to be a file name and the file itself is retrieved and 
compiled as it had been typed in full at this point of the input file.  
  
Included files may contain any valid Scenery MAKER commands and statements; 
they are usually used to store macro and value definitions which are common 
to several source files.  
  
Please note the difference between the COPY and the INCLUDE commands: COPY 
inserts a compiled file into the output, while INCLUDE retrieves a textual 
source file and compiles it.  
  
Note also that sexp is a normal string expression and, if given directly, 
it MUST be encosed between quotes.  
  
However, because the string is assumed to be a file name, the '\' character 
has not its special meaning and can be used directly; es.:  
  
	INCLUDE "c:\scenery\mydefs.inc"  
_____  
  
MACRO name (param1, param2,..) [LOCAL varname, varname ,..] .. text .. ENDMACRO  
  
Defines "name" as a macro. Macros are a kind of short-hand or abbreviation 
for a longer text. Once a macro has been defined, every time its name is used 
it will be replaced by the entire ..text..  
  
Macro body may contain complete commands, parts of commands, values, 
calculations, etc. The only command which, if present, should be complete is 
the WHILE ... ENDWHILE command. Of course, if the macro body is not made of  
complete commands, it should be used in a context where it makes sense.  
  
This is an example of a simple macro definition:  
  
	MACRO origin 0,0 ENDMACRO  
  
it could be used as in:  
  
	DW origin  
  
which would be equivalent to:  
  
	DW 0,0  
  
On the other hand, using the same macro as in  
  
	IF origin ...  
  
would result in  
  
	IF 0,0  
  
which is not correct.  
  
Macro may have parameters, i.e. place-holders for values which will be passed 
to the macro when used.  
  
If present, macro parameters are enclosed within parenteses, both in the 
macro definition and in the macro invocation. If the macro has no parameters, 
the parenteses are not used.  
  
An example of a macro with a parameter:  
  
	MACRO str25(strg)  
		(string 25) strg  
	ENDMACRO  
  
and an example of its possible usage:  
  
	DB str25("Milano Linate")  
  
Macro bodies may contain labels and may set values; they will be actually 
defined the first time the macro is used and are "globals", i.e. are also 
available outside of the macro (see also below, about the LOCAL statement).  
  
Macros may build on other macros; for instance, given the above definition of 
the macro "origin", the following macro can be defined:  
  
	MACRO origin3d origin,0 ENDMACRO  
  
which ends up equivalent to the text:  0,0,0  
  
On the other hand, macro CANNOT contain definitions of other macros; in other 
words, a trick like that:  
  
	MACRO DefFixedStr(Name, Length)  
		macro name  
			(string length)  
		endmacro  
	ENDMACRO  
  
which tries to define a template for fixed length string macros, is NOT legal!  
  
A macro may include, as FIRST statement, an optional LOCAL statement followed 
by any number of variable (or label) names. At each execution of the macro,  
those variables will then be created as "local", i.e. they will exist only 
for the duration of the macro and will desappear when the macro ends. 
As an example, this a macro which prepends the length to a text string:  
  
	MACRO StrWithLen(strg)  
		LOCAL FromHere, ToHere  
		DB ToHere - FromHere  
	FromHere:  
		DB strg  
	ToHere:  
	ENDMACRO  
  
If a local symbol has the same name of a global one, the former will "hide" 
the latter for the entire execution of the macro, but the global symbol 
will "reappear" intact when the macro ends.  
  
The LOCAL statement, if present, MUST be the FIRST statement of the macro and 
there should be ONLY ONE of it containing all the required local symbol names. 
As for any statement which admits multiple parameters, there is no limit to 
its length.  
  
Macro with a LOCAL statement are internally processed in a different way from 
'regular' macros and this has two consequences:  
  
   1) they are a bit slower to execute  
  
   2) they MUST contain COMPLETE, CORRECT commands; in other words, it is not 
      possible for them to contain only parts of commands, as it was the case 
      for the first macro example above: origin.  
  
For many examples of macro definitions, see the supplied sample source codes.  
_____  
  
SAVE  sexp  
  
sexp is assumed to be a file name; this command creates a new file with this 
name, containing all the symbols (macros and variables) currently defined in 
a pre-compiled format (pre-compiled header). Advantages of pre-compiled 
header above regular INCLUDE files are mainly two:  
  
   1) pre-compiled headers take less time to be processed, because the 
      pre-compiled form is already scanned and parsed;  
  
   2) when multiple and/or nested INCLUDE files are used, the pre-compiled 
      header generated after all the inclusions packs all the files in a 
      single file, simplifying the distribution.  
  
This command is intended for a very specific usage: after an INCLUDE file (or 
a set of INCLUDE files) has been tested and debugged and is in its finalized 
form, a short source file is prepared, usually containing only two lines like 
the following, and called, say, INC2PCM.SM:  
  
	INCLUDE "myinclud.inc"  
	SAVE "myinclud.pcm"  
  
if there are more file to be INCLUDEd, more lines like the first may appear 
or, instead, MYINCLUD.INC may include all the required include file itself.  
  
Then, Scenery MAKER is invoked on INC2SCM, as in:  
  
	sm inc2scm.sm dummy.bin  
  
INC2SCM.SM does not generate any actual output, then DUMMY.BIN will be an 
empty file, which can be ignored. However, the SAVE command will generate a 
pre-compiled header MYINCLUD.PCM containing all the symbols defined by the 
various include files, as long as the SAVE command is the last one.  
  
Pre-compiled header generated by the SAVE command can be read back with the 
READ and the MERGE commands.  
  
Note that sexp is a normal string expression and, if given directly, it MUST 
be encosed between quotes.  
  
However, because the string is assumed to be a file name, the '\' character 
has not its special meaning and can be used directly.  
_____  
  
READ  sexp  
  
sexp is assumed to be the name of a  file containing a pre-compiled header; 
this command first erases ALL the symbols (macros and variables) currently 
defined and then retrieves the file and reads its contents back in memory, 
actually recreating an exact image of the symbol set as it was when the SAVE 
command has been used.  
  
Note that sexp is a normal string expression and, if given directly, it MUST 
be encosed between quotes.  
  
However, because the string is assumed to be a file name, the '\' character 
has not its special meaning and can be used directly.  
_____  
  
MERGE  sexp  
  
This command is very similar to READ but, instead of erasing the currently 
defined symbols, it keeps them and adds to them the new symbols found in the 
pre-compiled header or replaces them with a new version found in the file. 
In detail:  
  
   a) if a symbol exists in memory and not in the file, it is kept as it is;  
  
   b) if a symbol exists in the file and not in memory, it is added;  
  
   c) if a symbol exists both in memory and in the file, the file version 
      replaces the memory version. There is however a notable exception: 
      if both version are numbers, the memory version is retained.  
  
Please note that, through this command, a symbol may change its nature; for 
instance, if a variable (or a label) called "origin" is currently defined and 
a macro also called "origin" exists in the file, the file version (a macro) 
replaces the memory version (a variable). This is the only case when such a 
change may happen in Scenery MAKER.  
_____  
  
WHILE (condition) statements... ENDWHILE  
  
The series of statements is repeated as long as the condition is true; when 
the condition becomes false, the execution continues after the ENDWHILE.  
The same notes about the if's condition apply also the while's condition.  
  
A WHILE ... ENDWHILE loop may contain two special commands:  
  
BREAK  
  
A BREAK command in a WHILE ... ENDWHILE contruct will force the loop to be 
exited, as if the WHILE's condition had become false.  
  
  
CONTINUE  
  
A CONTINUE command in a WHILE ... ENDWHILE construct will force execution to 
loop back to the WHILE, without executing the remaining commands up to the 
closing ENDWHILE.  
_____  
  
The following commands are specific to the vector calculations required for 
Flight Simulator. All their names begin with a double underscore to minimize 
clashes with names defined by the user.  
  
__DEFPOLY  
  
This command introduces the definition of a polygon for which a vector will 
be required and sets Scenery MAKER up for calculating that vector. It has no 
parameter.  
_____  
  
__DEFPT Enexp, Anexp, Nnexp  
  
This command introduces the definition of a point for which or upon which a 
vector will be required and sets Sce up for calculating that vector. It takes 
3 numeric parameters which define the 3 components of that point. The 3 
components are NOT directly output by this command; use a suitable Dx command 
in addition. Each __DEFPT command defines a new point, numbered sequentially 
from the number set by the last __FIRSTPT command onward.  
_____  
  
__FIRSTPT nexp  
  
This command sets the initial point number; it generally used at the 
beginning of a point list definition. It includes in itself the __VECTSECT 
functionality (see below). It setsthe Scenery MAKER vector generator but 
does not generate anything in the output file.  
_____  
  
__PTS nexp, nexp, nexp ...  
  
This command, which should follow the __DEFPOLY command, tells Scenery MAKER 
which are the points which define a polygon; points are indentified by their 
number.  

The point numbers, given by the nexp(s), are output to the output file as 
words.  
  
At least three __PTS commands (or just one or two, but with a total of three 
nexps) must follow each _DEFPOLY and the corresponding points have to appear 
in CLOCKWISE order looking at the polygon FROM OUTSIDE.  
  
Any additional __PTS command, after the first mandatory three, is simply 
ignored.  
_____  
  
__USEPTS nexp, nexp, nexp ...  
  
This command is very similar to __PTS, but it DOES NOT output the nexp(s) to 
the output files. This is primarily useful for calculating vectors without 
dumping the point coordinates, point numbers and polygon definition to the 
output file, as it is necessary for the conditional jumps based on vectors 
used in some instructions of the Flight Simulator Scenery Description 
Language.  
_____  
  
__VECT  
  
This command will calculate and output a vector. If used after a __DEFPOLY 
command, it will generate a polygon vector; if used after a __DEFPT command 
it will generate a point vector.  
_____  
  
__VECTSECT  
  
Information for calculating vectors is usually given AFTER the vector itself 
is required (point vectors depend upon the polygons in which the points 
appear and viceversa); therefore, Scenery MAKER performs vector calculation 
in two passes: during the first, it collects the necessary information and 
during the second it actually outputs the vectors.  
  
In addition, the same point number may be (and usually is) redefined with 
different coordinates and used for different polygons in different parts of 
a scenery, at which moment all vector information is outdated and must be 
collected again, in a new two-passes cycle.  
  
The __VECTSECT command, which takes no parameter, tells Scenery MAKER that a 
new cycle is beginning, forcing it to complete the second pass of the 
previous cycle and starting a new one.  
  
This command is actually seldom required because the most common way of 
defining a new set of points for vectored polygons is through the point list 
definition which is usually associated with __FIRSTPT command (the supplied  
DefPtList and DefVectPtList macros include the __FIRSTPT command); as noted 
above the latter command include the same functionality of __VECTSECT.  
_____  
  
The following commands are specific to the generation of the VOR and ILS 
table for Flight Simulator.  Also their names begin with a double underscore 
to minimize clashes with names defined by the user.  
  
__NAVTAB  
  
This command, which does not require any argument, is used to begin a VOR 
and/or ILS table.  
_____  
  
__VOR  
  
This command defines a Flight Simulator5 VOR. It must be used after __NAVTAB 
and before __ENDNAVTAB.  
  
It requires 9 arguments, in order:  
  
  * ID            string of up to 5 characters (if there are more, they are 
		  ignored)  
  * Name          string of up to 24 characters (if there are more, they are 
		  ignored)  
  * frequency     as a plain number with up to 2 decimal (es.: 113.45)  
  * latitude      in dms format (es.: 48d15m54.02sN)  
  * longitude     in dms format  
  * altitude      in m  
  * range         in NM  
  * magn. dev.    in dms format  
  * flag          1 for DME, 0 for no DME  
_____  
  
__ILS  
  
This command defines a Flight Simulator5 ILS. It must be used after __NAVTAB 
and before __ENDNAVTAB.  
  
It requires 14 arguments; the first nine are the same as for a __VOR, then 
five additional arguments follow, defining the glide path; in order:  
  
  * approach      in dms  
  * latitude      in dms format (es.: 48d15m54.02sN)  
  * longitude     in dms format  
  * altitude      in m  
  * glide angle   in dms  
_____  
  
__ENDNAVTAB  
  
This command, which does not require any argument, is used to close a VOR 
and/or ILS table.  
_____  
  
The navaid table must begin with a __NAVTAB command and end with 
a __ENDNAVTAB command. In its body, it may contain any number of VOR and/or 
ILS, in any order. Flight Simulator requires a very specific and complex 
table arrangement, which is however generated internally by Scenery MAKER.  
  
NOTE: There can be ONLY ONE navaid table in each sourcefile.  
  
The following is an example, showing these four commands in practice:  
  
__NAVTAB  
__ILS "IMSW", "MUNICH", 108.30,  48d20m28.00sN,  11d44m53.98sE,   
	453, 34,  2d, 2, 262.90d,    
	48d20m44.20sN,  11d48m7.20sE, 453, 3d  
__VOR "MAH", "MAISACH", 108.00,  48d15m54.02sN,  11d18m48.02sE,   
	530, 86,  3d, 1  
__ENDNAVTAB  
_____  
  
  
RESERVED, UNIMPLEMENTED COMMANDS  
  
The following commands are not implemented in this vesion of Scenery MAKER, 
but are reserved for future expansions, and cannot be used:  
  
	SELECT  
	OPTION  
	OTHERWISE  
	ENDSELECT  
	FUNC  
	ENDFUNC  
  
  
COMMENTS  
  
Comments begins with a semi-colon (';') and last until the end of the line; 
comments may be inserted at any point of the text between two components of 
a command and the command itself may continue on the next line if necessary. 
For instance:  
  
	DB RedCol,              ; set text color to red  
	   message$,            ; dump the message  
	   NormCol              ; set text color back to normal  
  
  
KEYWORD SUMMARY  
  
The following is a summary of Scenery MAKER keywords; these words cannot be 
used as names for macros, variables or labels.  
  
	__defpoly       __vor           else            not               
	__defpt         and             endfunc         option     
	__endnavtab     break           endif           or                
	__firstfreq     continue        endmacro        otherwise         
	__firstpt       copy            endselect       pow               
	__ils           cos             endwhile        read              
	__lastfreq      d3              func            save              
	__navtab        db              if              select            
	__pts           dd              include         sin        
	__sect0         def             khz             sqrt       
	__usepts        dq              macro           string            
	__vect          dt              merge           while             
	__vectsect      dw              mhz             


All Rights reserved.
(c) 1995,1996 Enrico Schiratti, LAGO
Scenery MAKER is (c) 1995,1996 Simula FlightWare, LAGO. 
Network drivers are (c) 1995,1996 Simon Hradecky, NOMISSOFT. 
Scenery Budapest and Scenery Delhi are (c) 1995,1996 Andras Kozma, LAGO. 
Microsoft and MS-DOS are either registered trademarks or trademarks of 
Microsoft Corporation in the United States and/or other countries. 
Flight Simulator is a trademark of Bruce A. Artwick. 
All other products and brands are trademarks or registered trademarks of 
their respective owners.
-----------------------------------------------------------------------------
Written by Maurizio Gavioli
*** END OF DOCUMENT ***
-----------------------------------------------------------------------------

